import { createStore } from 'vuex'
interface Obj {
  name: string;
  age: number;
  sex: string;
}
type ctx = {
  commit?:any,
  dispatch?:any,
  getters?:any,
  state?:any}
type Store = {
  state:{
    [things:string]:any
  },
  mutations:{
    [things:string]:(state:any,data:any)=> void
  },
  actions?:{
    [things:string]:(ctx:ctx,data:any)=> void
  },
  modules?:any,
  getters?:any
}
const create:Store = {
  state: {
    obj: {
      name: '123',
      age: 21,
      sex: '男'
    },
    index: 0
  },
  mutations: {
    ina: function (state,data) {
      state.index = state.index + data
    }
  },
  actions: {
    ind: function ({commit},data) {
      commit('ina',data)
    }
  },
  modules: {
  },
  getters: {
    liu: function (state:any) {
      return state.obj
    },
    indexa: function (state:any) {
      return state.index
    }
  }
}
export default createStore({...create})
